package com.zlzxm.shoesmarket.view.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.zlzxm.shoesmarket.R;
import com.zlzxm.shoesmarket.util.ZViewHelp;
import com.zlzxm.shoesmarket.view.adapter.entity.EntityBuySaleAllInfo;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * CREATE BY zlzxm ON 4/14/21
 */
public class ADBuySaleAllInfo extends BaseQuickAdapter<EntityBuySaleAllInfo, BaseViewHolder> {

    public ADBuySaleAllInfo( @Nullable List<EntityBuySaleAllInfo> data) {
        super(R.layout.item_buy_sale_all, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, EntityBuySaleAllInfo entity) {

        RequestOptions requestOptions = new RequestOptions().transform(new CenterCrop(),
                new RoundedCorners(ZViewHelp.dpTopx(getContext(),4)));

        Glide.with(getContext())
                .load(entity.getUrl())
                .apply(requestOptions)
                .into((ImageView) holder.getView(R.id.ivFace));

        holder.setText(R.id.tvTitle,entity.getTitle());
        holder.setText(R.id.tvDesc,entity.getDesc());
        holder.setText(R.id.tvIn,"入库数"+entity.getIn());
        holder.setText(R.id.tvSale,"销售额"+entity.getSaleMoney());
        holder.setText(R.id.tvOut,"出库数"+entity.getOut());
        holder.setText(R.id.tvProfit,"净利润"+entity.getProfit());
        holder.setText(R.id.tvSave,"库存"+entity.getSave());
        holder.setText(R.id.tvProfitRate,"净润率"+entity.getProfitRate());
        holder.setText(R.id.tvCost,"库存成本"+entity.getCost());
        holder.setText(R.id.tvDays,"平均持有天数"+entity.getDays());


    }
}
